package com.dubbo;

public class JITMethodInner {
    public static int squater(int base) {
        return base * base;
    }

    public static void main(String[] args) {
        for (int i = 0; i < 200; i++) {
            long start = System.nanoTime();
            for (int j = 0; j < 1000; j++) {
                squater(9);
            }
            long end = System.nanoTime();
            System.out.println(end - start);
        }
    }
}

/**
 * /usr/local/jdk1.8.0_341/bin/java -javaagent:/snap/intellij-idea-ultimate/383/lib/idea_rt.jar=41157:/snap/intellij-idea-ultimate/383/bin -Dfile.encoding=UTF-8 -classpath /usr/local/jdk1.8.0_341/jre/lib/charsets.jar:/usr/local/jdk1.8.0_341/jre/lib/deploy.jar:/usr/local/jdk1.8.0_341/jre/lib/ext/cldrdata.jar:/usr/local/jdk1.8.0_341/jre/lib/ext/dnsns.jar:/usr/local/jdk1.8.0_341/jre/lib/ext/jaccess.jar:/usr/local/jdk1.8.0_341/jre/lib/ext/jfxrt.jar:/usr/local/jdk1.8.0_341/jre/lib/ext/localedata.jar:/usr/local/jdk1.8.0_341/jre/lib/ext/nashorn.jar:/usr/local/jdk1.8.0_341/jre/lib/ext/sunec.jar:/usr/local/jdk1.8.0_341/jre/lib/ext/sunjce_provider.jar:/usr/local/jdk1.8.0_341/jre/lib/ext/sunpkcs11.jar:/usr/local/jdk1.8.0_341/jre/lib/ext/zipfs.jar:/usr/local/jdk1.8.0_341/jre/lib/javaws.jar:/usr/local/jdk1.8.0_341/jre/lib/jce.jar:/usr/local/jdk1.8.0_341/jre/lib/jfr.jar:/usr/local/jdk1.8.0_341/jre/lib/jfxswt.jar:/usr/local/jdk1.8.0_341/jre/lib/jsse.jar:/usr/local/jdk1.8.0_341/jre/lib/management-agent.jar:/usr/local/jdk1.8.0_341/jre/lib/plugin.jar:/usr/local/jdk1.8.0_341/jre/lib/resources.jar:/usr/local/jdk1.8.0_341/jre/lib/rt.jar:/home/cqh/IdeaProjects/study/jvm/target/classes com.dubbo.JITMethodInner
 * 72371
 * 27744
 * 26472
 * 24418
 * 24077
 * 32523
 * 24648
 * 24508
 * 24699
 * 24779
 * 24799
 * 27373
 * 25149
 * 24788
 * 24979
 * 25600
 * 25239
 * 27083
 * 27654
 * 27544
 * 26562
 * 26452
 * 26231
 * 26512
 * 24919
 * 25430
 * 25340
 * 25600
 * 26622
 * 24899
 * 27173
 * 32243
 * 32914
 * 33486
 * 32263
 * 31732
 * 31782
 * 32634
 * 32002
 * 31572
 * 31401
 * 32072
 * 27694
 * 24398
 * 24297
 * 24588
 * 23766
 * 24648
 * 24298
 * 24748
 * 24288
 * 22975
 * 23786
 * 23225
 * 23797
 * 23636
 * 24318
 * 23215
 * 25981
 * 23686
 * 27704
 * 26041
 * 28335
 * 25590
 * 26261
 * 28305
 * 25850
 * 27264
 * 27514
 * 26182
 * 27564
 * 26521
 * 27944
 * 24518
 * 1873
 * 1894
 * 1874
 * 1874
 * 1864
 * 5221
 * 1893
 * 1874
 * 1994
 * 2245
 * 1873
 * 1873
 * 1874
 * 1874
 * 2545
 * 1934
 * 1884
 * 1864
 * 1874
 * 1874
 * 1884
 * 3026
 * 2475
 * 1874
 * 1873
 * 1874
 * 1864
 * 1914
 * 1914
 * 1913
 * 7515
 * 1914
 * 1984
 * 1913
 * 1934
 * 1913
 * 1944
 * 1903
 * 2445
 * 2024
 * 1944
 * 1904
 * 1913
 * 1934
 * 3257
 * 1913
 * 2505
 * 1913
 * 1924
 * 1914
 * 1914
 * 1914
 * 1914
 * 1914
 * 2625
 * 1903
 * 1914
 * 1903
 * 1914
 * 1914
 * 1914
 * 1914
 * 1914
 * 2405
 * 1923
 * 3166
 * 1914
 * 1913
 * 1913
 * 1914
 * 1914
 * 2585
 * 1914
 * 1913
 * 1904
 * 1904
 * 1914
 * 1914
 * 1914
 * 35028
 * 14448
 * 20 //后面性能优化明显 JIT 对于调用平凡且代码简短的方法进行了内联优化 即方法和 调用者合并成为一个方法
 * 30 //以及将9 * 9 = 81存储 不再计算
 * 30
 * 30
 * 30
 * 30
 * 30
 * 30
 * 30
 * 30
 * 30
 * 20
 * 30
 * 30
 * 30
 * 20
 * 20
 * 31
 * 30
 * 30
 * 31
 * 20
 * 20
 * 20
 * 30
 * 30
 * 30
 * 20
 * 20
 * 20
 * 20
 * 20
 * 30
 * 30
 * 30
 * 30
 * 20
 * 20
 * 20
 * 30
 * 20
 * 30
 * 20
 * 20
 * 30
 * 20
 */
